package 实验.实验六;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyException extends RuntimeException {
    public MyException() {}
    public MyException(String s) {
        super(s);
    }

    public static void main(String[] args) {
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        String format = sdf.format(new Date());
        Date parse = null;
        try {
            parse=sdf.parse("09:00:00");
        }catch (ParseException e) {
            e.printStackTrace();
        }
        System.out.println("当前时间："+format);
        if (new Date().after(parse)){
            try{
                throw new MyException("超过九点不允许打卡");
            }catch (MyException e){
                System.out.println(e.getMessage());
            }
        }
    }
}

